package shiqi.util;

import shiqi.enums.ExceptionCodeEnum;
import shiqi.exception.BizException;
import shiqi.vo.UserVo;

import java.util.Optional;
import java.util.function.Supplier;

/**
 * @author shiqi
 * @version 1.0.0
 * @ClassName TestOptional.java
 * @Description
 * @createTime 2022-05-07
 */
public class TestOptional {

    public static void main(String[] args) throws Throwable {
        UserVo userVo = null;
        UserVo userVo1 = Optional.ofNullable(userVo).orElseThrow(() -> new BizException(ExceptionCodeEnum.ERROR));
        System.out.println(userVo1);
    }
}
